#ifndef VIDEOWIDGET_H
#define VIDEOWIDGET_H

#include <QObject>
#include <QWidget>
#include <QMutex>

class VideoWidget : public QWidget
{
    Q_OBJECT
public:
    explicit VideoWidget(QWidget *parent = nullptr);
    ~VideoWidget() override;
public slots:
    void setFrame(const QImage& frame); // 修改为接收智能指针
    //void setFrame(const QImage& frame);
    void clearFrame(); // 新增清除帧方法
protected:
    void paintEvent(QPaintEvent *event) override;

private:
    //QSharedPointer<QImage> m_currentFrame; // 保存智能指针而非 QPixmap
    QPixmap m_currentFrame;
    QMutex m_mutex;
};

#endif // VIDEOWIDGET_H
